from django.contrib import admin

from device.models import deviceInfo, channelInfo, temperatureInfo, warningSettingInfo, warningDeviceInfo, \
    warningDistrictSetting


class deviceInfoAdmin(admin.ModelAdmin):
    list_display = ("id", "code", 'name', 'ip_address', 'port')
    # list_editable = ['planned_complete_date', ]
    # list_filter = ("status", 'belong_product', 'source', 'belong_employees')
    # search_fields = ('name', 'describe')


class channelInfoAdmin(admin.ModelAdmin):
    list_display = ("id", "code", 'name', 'meter_start', 'meter_end', 'is_valid')
    # list_editable = ['planned_complete_date', ]
    # list_filter = ("status", 'belong_product', 'source', 'belong_employees')
    # search_fields = ('name', 'describe')


class temperatureInfoAdmin(admin.ModelAdmin):
    list_display = ("id", 'belong_channel', "meter_address", 'temperature_info', 'order_time')
    # list_editable = ['planned_complete_date', ]
    list_filter = ('belong_channel', )
    # search_fields = ('name', 'describe')

class warningDistrictSettingAdmin(admin.ModelAdmin):
    list_display = (
        "id", "code", 'name', 'meter_start', 'meter_end', "temperature_info", 'is_valid')
    # list_editable = ['planned_complete_date', ]
    # list_filter = ("status", 'belong_product', 'source', 'belong_employees')
    # search_fields = ('name', 'describe')

class warningSettingInfoAdmin(admin.ModelAdmin):
    list_display = (
    "id", "belong_channel", 'meter_start', 'meter_end', "constant_threshold", "is_constant_threshold",
    "different_threshold", 'is_different_threshold')
    # list_editable = ['planned_complete_date', ]
    # list_filter = ("status", 'belong_product', 'source', 'belong_employees')
    # search_fields = ('name', 'describe')


class warningDeviceInfoAdmin(admin.ModelAdmin):
    list_display = ("id", 'belong_channel', "meter_address", 'temperature_info', 'warning_type')
    # list_editable = ['planned_complete_date', ]
    list_filter = ('warning_type','belong_channel')
    # search_fields = ('name', 'describe')


admin.site.register(deviceInfo, deviceInfoAdmin)
admin.site.register(channelInfo, channelInfoAdmin)
admin.site.register(temperatureInfo, temperatureInfoAdmin)
admin.site.register(warningDistrictSetting, warningDistrictSettingAdmin)
admin.site.register(warningSettingInfo, warningSettingInfoAdmin)
admin.site.register(warningDeviceInfo, warningDeviceInfoAdmin)